package com.lvbaoins.Harmony.utils;


/**
 * 密码检查
 * @author liwei
 *
 */
public class PasswordUtil {

	/**
	 * 
	 * @param userName 用户名
	 * @param password 密码（未加密）
	 * @return
	 */
	public static String createPassword(String userName,String password) {
		String pwd = userName+password+userName;
		try {
			pwd = MD5Encrypt.getMessageDigest(pwd);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return pwd;
	}
	
	/**
	 * 验证用户密码是否正确
	 * @param user 用户
	 * @param password 待验证密码
	 * @return
	 */
	public static boolean check(String userCode,String password,String checkPasword) {
		String checkPwd = createPassword(userCode,checkPasword);
		return password.equals(checkPwd);
	}
}
